package com.zeratul.cloud.demo1.controller;

import com.zeratul.common.core.result.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/config")
@Slf4j
public class ConfigTestController {

    @Autowired
    private Environment environment;

    @GetMapping
    public R getConfig(String key){
        log.info("【获取配置】key:{}", key);
        return R.success(environment.getProperty(key));
    }
}
